package com.ivo.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.ivo.model.Model;

@Entity
@org.hibernate.annotations.Entity(dynamicUpdate=true)
@Table (name = "PDM_R_USER_ROLE")
public class UserRole extends Model {

	private static final long serialVersionUID = 6686625515539386131L;
	private Long userRoleId;
	private Role role;
	private String userId;
	private Category category;
		
	public UserRole(){}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "USER_ROLE_ID")
	public Long getUserRoleId() {
		return userRoleId;
	}

	public void setUserRoleId(Long userRoleId) {
		this.userRoleId = userRoleId;
	}
	
	@ManyToOne(cascade = {CascadeType.MERGE})
	@JoinColumn(name = "ROLE_FK")
	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}
	
	@Column(name = "USER_FK")
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	@ManyToOne(cascade = {CascadeType.MERGE})
	@JoinColumn(name = "CATE_FK", nullable = true)
	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}
	

}
